{% extends 'users/profile-base.html' %}
{% load static %}
{% load tasks_tags %}

{% block right_frame %}

    <div class="profile-frame__right">
        <div class="profile-frame__right__tasks-container">

            {% if not count and year == actual_year %}
                <div class="addEmptyTasks">
                    <a class="addEmptyTasks" href="{% url "task:task-empty-add" user.email %}">
                        <button class="addNewEmptyTasksBtn">Добавить новые задачи</button>
                    </a>
                    
                </div>
            {% endif %}

            {% for task in tasks %}
                {% if task.status == 'EM' %}
                    <div class="task glass">
                        <a href="{% url 'task:task-add' task.id %}">
                            <div class="addTaskBtn"></div>
                        </a>
                    </div>
                {% elif task.is_done %}
                    <a href="{% url 'task:task-detail' task.id %}"><div class="task taskDone green-color"><p>{{ task.title|truncatewords:2 }}</p></div></a>
                {% else %}
                    <a href="{% url 'task:task-detail' task.id %}"><div class="task glass"><p>{{ task.title|truncatewords:3 }}</p></div></a>
                {% endif %}
            {% endfor %}
        </div>

        <div class="profile-frame__right__result">
            {% if rewards %}
                {% for item in rewards %}
                    <img src="{{ item.reward.reward_img.url }}" alt="item.reward.slug">
                {% endfor %}
            {% endif %}
            <div class="result-container">
                {% if count %}
                    <p class="totalResult">Выполнено: {{ ready }}/{{ count }}</p>
                    {% if all_done %}
                        <div class="addAnotherTasks">
                            <button class="addAnotherTasksBtn">+8 задач</button>
                            <a class="addAnotherTasksUrl hidden" href="{% url "task:task-empty-add" user.email 8 %}">
                                <button class="addTasksBtn confirm">Добавить</button>
                            </a>
                            
                        </div>
                    {% endif %}
                {% endif %}
                
            </div>
        </div>

        <div class="profile-frame__right__progress">
            {% if tasks %}
                <div class="profile-frame__right__progress-container border-bottom">
                    {% for block in tasks %}
                        {% if block.is_done %}
                            <div class="progress-block green-color"></div>
                        {% else %}
                            <div class="progress-block"></div>
                        {% endif %}
                    {% endfor %}
                </div>
            {% endif %}
        </div>
    </div>

{% endblock right_frame %}
